<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .container{
            width:800px;
            height:200px;
        }
        .left{
            background:red;
            /* float:left; */
            /* height:100%; */
            width:200px;
            position: absolute;
            height:200px;
        }
        .right{
            background:blue;
            float:right;
            width:200px;
            height:100%;
        }
        .middle{
            margin-left:200px;
            margin-right:200px;
        }
        
    </style>
</head>
<body>
    <div class="container">

        <div class="left">
            左
        </div>

        <div class="right">
            右
        </div>

        <!-- 这里之所以把中间放后面是如果先放了middle,后面的right会因为位置不够位置而出现排版偏移, -->
        <!-- 所以先让float元素的先放再放非float元素 -->
        <div class="middle">
            中间
        </div>
    </div>
</body>
</html>